home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / printfault.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  92 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: printfault.c,v 1.4 1996/10/24 15:50:34 aros Exp $
  4.     $Log: printfault.c,v $
  5.     Revision 1.4  1996/10/24 15:50:34  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.3  1996/08/13 13:52:49  digulla
  9.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  10.     Replaced AROS_LA by AROS_LHA
  11.  
  12.     Revision 1.2  1996/08/01 17:40:55  digulla
  13.     Added standard header for all files
  14.  
  15.     Desc:
  16.     Lang: english
  17. */
  18. #include <clib/exec_protos.h>
  19. #include "dos_intern.h"
  20.  
  21. /*****************************************************************************
  22.  
  23.     NAME */
  24.     #include <clib/dos_protos.h>
  25.  
  26.     AROS_LH2(BOOL, PrintFault,
  27.  
  28. /*  SYNOPSIS */
  29.     AROS_LHA(LONG,   code,   D1),
  30.     AROS_LHA(STRPTR, header, D2),
  31.  
  32. /*  LOCATION */
  33.     struct DosLibrary *, DOSBase, 79, Dos)
  34.  
  35. /*  FUNCTION
  36.     Prints the header and the text associated with the error code to
  37.     the console (buffered), then sets the value returned by IoErr() to
  38.     the error code given.
  39.  
  40.     INPUTS
  41.     code   - Error code.
  42.     header - Text to print before the error message.
  43.  
  44.     RESULT
  45.     !=0 if all went well. 0 on failure.
  46.  
  47.     NOTES
  48.  
  49.     EXAMPLE
  50.  
  51.     BUGS
  52.  
  53.     SEE ALSO
  54.  
  55.     INTERNALS
  56.  
  57.     HISTORY
  58.     29-10-95    digulla automatically created from
  59.                 dos_lib.fd and clib/dos_protos.h
  60.  
  61. *****************************************************************************/
  62. {
  63.     AROS_LIBFUNC_INIT
  64.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  65.  
  66.     struct Process *me=(struct Process *)FindTask(NULL);
  67.     BPTR stream=me->pr_CES?me->pr_CES:me->pr_COS;
  68.     struct EString *es=EString;
  69.     BOOL ret=0;
  70.  
  71.     /* First find error string */
  72.     while(es->Number)
  73.     {
  74.     if(es->Number==code)
  75.         break;
  76.     es++;
  77.     }
  78.  
  79.     /* Print everything */
  80.     if(!FPuts(stream,header)&&
  81.        !FPuts(stream,": ")&&
  82.        !FPuts(stream,es->String)&&
  83.        !FPuts(stream,"\n"))
  84.     ret=1;
  85.  
  86.     /* All done. */
  87.     me->pr_Result2=code;
  88.     return ret;
  89.  
  90.     AROS_LIBFUNC_EXIT
  91. } /* PrintFault */
  92.